// eslint-disable-next-line no-unused-vars
import { emptydata } from '../../../../../../../../../global/Classes/cla_emptydata/Classes/cla_emptydata';
import {
  css_high_light_dom,
  css_wind_light_hover,
} from '../../../../../../../../../global/element/DataDefine/sourceData';
import { domTree } from '../../../../../../../../../global/element/domTree';
import {
  normalizeContainer,
  packNode,
} from '../../../../../../../../../global/element/Func';
import { fsl_comps_boder_id, fsl_uni_comp_cla } from '../DataDefine/sourceData';
import { float_setting_list_info } from './cla_float_setting_list_unit_comp_Domt';
// eslint-disable-next-line no-unused-vars
import { float_setting_list_unit_comp_Domt } from './cla_float_setting_list_unit_comp_Domt/cla_float_setting_list_unit_comp_Domt';

const float_setting_list_dataManaTag = 'float_setting_list_dataMana';

class float_setting_list_dataMana {
  get [Symbol.toStringTag]() {
    return float_setting_list_dataManaTag;
  }

  constructor() {}

  /**
   * 浮动元素 设定 列 容器
   * @type {HTMLElement}
   */
  fsl_comps_boder_el = normalizeContainer(fsl_comps_boder_id);

  /**
   * @type  {emptydata}
   * 填充信息 是 {float_setting_list_unit_comp_Domt}
   */
  fsl_static_node_info;

  /**
   * 生长 当前 dom 元素
   */
  o_grow_fsl_dom() {
    // 置空 list 容器
    this.fsl_comps_boder_el.innerHTML = '';

    this.fsl_static_node_info = get_static_dom_info();

    /**
     * @type {float_setting_list_unit_comp_Domt}
     */
    let cur_node_info;

    for (const key of this.fsl_static_node_info['data']) {
      cur_node_info = this.fsl_static_node_info[key];

      let cur_child_node = init_unit_dom(cur_node_info);

      packNode(this.fsl_comps_boder_el, cur_child_node);
    }
  }
}

/**
 * 根据 给定的 元素 信息 创建 相应的 定式 dom
 * @param {float_setting_list_unit_comp_Domt} dom_obj
 * @returns {HTMLElement}
 */
function init_unit_dom(dom_obj) {
  let dom_t = {
    tag: 'div',
    class: [fsl_uni_comp_cla, css_wind_light_hover, css_high_light_dom],
    prop: ['id'],
    events: ['click'],
    id: fsl_uni_comp_cla,
    click: dom_obj.click_fuc,
    queue: ['span_tag'],
    span_tag: {
      tag: 'span',
      prop: ['innerHTML'],
      innerHTML: dom_obj.span_tag,
    },
  };

  return domTree(dom_t);
}

function get_static_dom_info() {
  // let cur_script_url = import.meta.url;
  // console.log(cur_script_url);

  return float_setting_list_info;
}

export { float_setting_list_dataMana };
